﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Gnosis.Babel;

namespace Gnosis.SQLite.Clauses
{
    public class Raise
        : Function
    {
        private Raise(string type)
            : base("RAISE", new TextLiteral(type))
        {
        }

        private Raise(string type, string errorMessage)
            : this(type)
        {
            AddChild(new TextLiteral(errorMessage));
        }

        public static readonly Raise Ignore = new Raise("IGNORE");

        public static Raise Rollback()
        {
            return new Raise("ROLLBACK");
        }

        public static Raise Rollback(string errorMessage)
        {
            return new Raise("ROLLBACK", errorMessage);
        }

        public static Raise Abort()
        {
            return new Raise("ABORT");
        }

        public static Raise Abort(string errorMessage)
        {
            return new Raise("ABORT", errorMessage);
        }

        public static Raise Fail()
        {
            return new Raise("FAIL");
        }

        public static Raise Fail(string errorMessage)
        {
            return new Raise("FAIL", errorMessage);
        }
    }
}
